#pragma once
#include <nice2d/widgets/layout.h>
#include <nice2d/widgets/label.h>

class TextTableStyle : public LayoutStyle
{
    DECLARE_OBJECT(TextTableStyle)
public:
    TextTableStyle();
    virtual ~TextTableStyle();

    std::shared_ptr<LabelStyle> labelStyle;
};

class TextTable : public Layout
{
    DECLARE_OBJECT(TextTable)
public:
    TextTable() = delete;
    TextTable(uint32_t rowcount,uint32_t colcount);
    ~TextTable();
public:
    void setText(const sf::String& text,uint32_t row,uint32_t col,const sf::Color& color = sf::Color::White);

    void setColAlignment(uint32_t col,HMode mode = HMode_Center);
    void setColWidth(uint32_t col,float width = 32.0f);
    void setRowHeight(float height);
private:
    virtual void onStyleChanged()override;
    void adjust()override;
private:
    std::unique_ptr<class TextTableData> data;
};
